<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>计算SKU</title>
</head>
<script>
  function cartesianProductOf(...args) {
    return args.reduce((total, current) => {
      let ret = [];
      total.forEach(a => {
        current.forEach(b => {
          ret.push(a.concat([b]));
        });
      });
      return ret;
    }, [[]]);
  }

  console.log(cartesianProductOf(['红色', '黑色'], ['衣服', '裤子']));
</script>
<body>
<div id="app"></div>
</body>
</html>
